package com.jspgou.cms.manager;

import java.util.HashSet;
import java.util.List;
import java.util.Map;

import org.springframework.web.multipart.MultipartFile;

import com.jspgou.common.hibernate3.Updater;
import com.jspgou.common.page.Pagination;
import com.jspgou.cms.entity.Product;
import com.jspgou.cms.entity.ProductExt;
import com.jspgou.cms.entity.ProductTag;

/**
 * 商品管理接口
 * 
 * @author liufang
 * 
 */
public interface ProductMng {

	public List<Product> getList(Long storeId,Long typeId,Long brandId,String productName);

	public List<Product> getListForTag(Long webId, Long ctgId, Long tagId,
			Long storeId,int firstResult,int maxResults);

	public Pagination getPage(Long webId, Long ctgId,Long storeId,String productName,
			String brandName,Long source,Boolean Ontheshelf,Boolean Whetherban,
			Boolean Whetherpresale,Long typeId,Double startSalePrice,Double endSalePrice,
			Integer startStock,Integer endStock,int pageNo, int pageSize);
	
	public Pagination getPageForTagChannel(Long webId,Long brandRadio,String brandId, Long ctgId,Long storeId,
			Long tagId,Long storeCategoryId,String[] names,String[] values,
			int orderBy,Double startPrice,Double endPrice,int pageNo, int pageSize);

	public Pagination getPageForTag(Long webId, Long ctgId, Long tagId,int pageNo, int pageSize);

	public Product findById(Long id);
	
	public Product updateByUpdater(Updater<Product> updater);
	
	public void updateViewCount(Product product);
	
	/**
	 * 删除商品级联的tag
	 * 
	 * @param tags
	 * @return 级联的商品数量
	 */
	public int deleteTagAssociation(ProductTag[] tags);

	public Product save(Product bean, ProductExt ext, Long webId, Long ctgId,
			Long brandId,Long[] storeCategoryIds, Long[] tagIds,Long promoteId, String[] keywords,String[] names,
			String[] values,String fashionSwitchPic[],MultipartFile file);

	public Product update(Product bean, ProductExt ext, Long ctgId, 
			Long brandId,Long promoteId,Long[] storeCategoryIds, Long[] tagIds, String[] keywords,String[] names,
			String[] values,Map<String, String> attr,
			String fashionSwitchPic[],MultipartFile file);
	
	public Product update(Product bean);

	public Product[] deleteByIds(Long[] ids);
	
	public List<Product> getLimitProduct(Long id);
	
	public Integer getStoreByProductPattern(Long id,Long fashId);
	
	public Integer getTotalStore(Long productId);
	
	public List<Product> getHistoryProduct(HashSet<Long> set,Integer count);
	
	public void addCorrelation(Product bean,Long correlationIds[]);
	
	public void updateCorrelation(Product bean,Long correlationIds[]);
	
	public void addCombination(Product bean,Long combinationIds[]);
	
	public void updateCombination(Product bean,Long combinationIds[]);
	
	public List<Product> getCountProduct(Long webId,Long ctgId);
	
	public String getTipFile(String key);
}